This is a sample Connected Lens project that uses Spectacles Sync Kit.
NOTE: This project will only work for the Spectacles platform.
Designing Lenses for Spectacles offers all-new possibilities to rethink user interaction with digital spaces and the physical world. Get started using our Design Guidelines
- Lens Studio: v5.15.1+
- Spectacles OS Version: v5.64+
- Spectacles App iOS: v0.64+
- Spectacles App Android: v0.64+
To update your Spectacles device and mobile app, please refer to this guide.
You can download the latest version of Lens Studio from here.
The camera feature requires you to use Experimental APIs. Please see Experimental APIs for more details here.
Extended Permissions mode on device must be enabled for enabling some of the Spectacles APIs. Please see Extended Permissions for more details here.
To obtain the project folder, clone the repository.
IMPORTANT: This project uses Git Large Files Support (LFS). Downloading a zip file using the green button on GitHub will not work. You must clone the project with a version of git that has LFS. You can download Git LFS here.
The project should be pre-configured to get you started without any additional steps. However, if you encounter issues in the Logger Panel, please ensure your Lens Studio environment is set up for Spectacles.
The following scripts sync the game using Spectacles Sync Kit sync entities and storage properties.
-
AirHockeyPuckTS.ts / AirHockeyPuckJS.js: This script controls the air hockey puck. It handles physics collisions and synced motion of the puck .
-
AirHockeyPaddleTS.ts / AirHockeyPaddleJS.js: This script controls the paddles. It handles collisions and syncs the position of each player's paddle.
-
AirHockeyControllerTS.ts / AirHockeyControllerJS.js: This script controls the game. It handles starting the game, detecting goals, and updating the score.
Open two Preview panels to test with multiple users in the Connected Lens. Each Preview simluates a user in the multiplayer session. Select the Start button to begin playing the game. Each Preview panel takes ownership of a paddle. Move the paddle side to side with your mouse to intercept the puck. The scoreboard updates to reflect goals scored.
To test Connected Lenses on your device, refer to the guide provided here.
After successfully installing the Lens, pinch the Multiplayer button to being the Connected Lenses colocated joining flow. When the air hockey board appears, pinch the Start button to start the game. Pinch a paddle to move it to hit the puck.
If you have any questions or need assistance, please don't hesitate to reach out. Our community is here to help, and you can connect with us and ask for support here. We look forward to hearing from you and are excited to assist you on your journey!
Feel free to provide improvements or suggestions or directly contributing via merge request. By sharing insights, you help everyone else build better Lenses.
Built with 👻 by the Spectacles team
